const express = require("express")
const path = require("path")
// const bodyParser = require("./body-parser.js") //自定义中间件
const bodyParser =require("body-parser") 


let app = express();
// app.use(bodyParser());
app.use(bodyParser.urlencoded({extended:false}))

app.get('/',(req,res)=>{
    // console.log("111");
    //加载一个表单页面，来发送post数据
    res.sendFile(path.join(__dirname,"./views/index.html"));
})

app.post('/postdata',(req,res)=>{
    
    console.log(req.body,"222")
    res.send("post请求过来了")
})

app.listen(8889)